<template>
  <div id="app">
    <el-breadcrumb
      separator-class="el-icon-arrow-right"
      style="margin: 15px 25px"
    >
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <div @click="showMain">
        <el-breadcrumb-item
        >志愿者招聘</el-breadcrumb-item
      >
      </div>
    </el-breadcrumb>
    <el-form ref="form" :model="volunteerform" label-width="80px">
      <el-form-item label="招聘标题" prop="title">
        <el-input v-model="volunteerform.title"></el-input>
      </el-form-item>
      <el-form-item label="职位" prop="position">
        <el-input v-model="volunteerform.position"></el-input>
      </el-form-item>
      <el-form-item label="工作地点" prop="workPlace">
        <el-input v-model="volunteerform.workPlace"></el-input>
      </el-form-item>
      <el-form-item label="招娉要求" prop="workSalary">
        <el-input v-model="volunteerform.workSalary"></el-input>
      </el-form-item>
      <el-form-item label="姓名" prop="lead">
        <el-input v-model="volunteerform.lead"></el-input>
      </el-form-item>
      <el-form-item label="手机" prop="contact">
        <el-input v-model="volunteerform.contact"></el-input>
      </el-form-item>
      <el-form-item>
        <el-input
          type="textarea"
          :rows="5"
          prop="workRequire"
          placeholder="请输入招娉原因"
          v-model="volunteerform.workRequire"
        >
        </el-input>
      </el-form-item>
      <el-button type="primary" @click="getformlist">提交志愿者表单</el-button>
    </el-form>
      
  </div>
</template>

<script>


export default {
  name: "volunteerform",
  data() {
    return {
      volunteerform: {
        title: "",
        position: "",
        workPlace: "",
        workSalary: "",
        lead: "",
        contact: "",
        workRequire: "",
      },
    };
  },
  methods: {
    async getformlist() {
      let { data: res } = await this.$axios.post("/volunteer/add", {
        title: this.volunteerform.title,
        position: this.volunteerform.position,
        workPlace: this.volunteerform.workPlace,
        workSalary: this.volunteerform.workSalary,
        lead: this.volunteerform.lead,
        contact: this.volunteerform.contact,
        workRequire: this.volunteerform.workRequire,
      });
      // console.log(res.data);
      if (res.code == 200) {
        this.$message.success("添加成功");
      } else {
        this.$message.error("添加失败", res.data.message);
      }
      this.$refs.form.resetFields();
    },
    showMain(){
      this.$emit('FormMain','showMain')
    }
  },
};
</script>

<style lang="scss" scoped>
#app {
  height: 100%;
  border: 2px solid rgb(88, 221, 254) ;
  width: 50%;
  margin: 0 auto;
  box-shadow: 1px 1px 1px 1px rgba(88, 221, 254, 0.8);
  border-radius: 4px;
  .el-form-item {
    margin: 25px 20px;
    box-shadow: 1px 1px 1px 1px rgba(88, 221, 254, 0.4);
    font-size: 20px;
  }
}
</style>